﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SOMSerialIncentiveCFM.aspx.cs"
    Inherits="sWarranty.WEB.SOMSerialIncentiveCFM" %>

<%@ Register Src="../UC/Header.ascx" TagName="Header" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../CSS/table.css" />
    <link rel="stylesheet" type="text/css" href="../CSS/Menu.css" />
    <link href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" rel="stylesheet"
        type="text/css" />
    <script src="../JS/jquery-1.8.2.js" type="text/javascript"></script>
    <script src="../JS/jquery-ui.js" type="text/javascript"></script>
    <script src="../JS/Menu.js" type="text/javascript"></script>
    <style>
        .changed
        {
            background: blue;
        }
        .nonChanged
        {
            background: white;
        }
    </style>
    <script>
        $(document).ready(function () {
            $("#txtFromDate").datepicker({ dateFormat: "mm/dd/yy" }).datepicker("setDate", "-7");
            $("#txtToDate").datepicker({ dateFormat: "mm/dd/yy" }).datepicker("setDate", new Date());
            $("#txtFromDate").attr('readOnly', 'true');
            $("#txtToDate").attr('readOnly', 'true');

            $(".checkbox").click(function () {
                var x = $(this).attr('id');
                var span = document.getElementById('myspan.' + x.replace("chk.", ""));
                var txt = document.getElementById('txt.' + x.replace("chk.", "")).value;
                if ($(this).is(':checked')) {
                    span.innerHTML = 'Y';
                    document.getElementById('txtIncentiveConfirmed').value = document.getElementById('txtIncentiveConfirmed').value.replace(txt + "|", "");
                    document.getElementById('txtIncentiveConfirmed').value += txt + "|";
                    $('.incentiveFlag').last().css({ 'background': 'blue' });
                }
                else {
                    span.innerHTML = 'N';
                    document.getElementById('txtIncentiveConfirmed').value = document.getElementById('txtIncentiveConfirmed').value.replace(txt + "|", "");
                    $('.incentiveFlag').last().css({ 'background': 'white' });
                }
            });
        });
        function openPopUp(popUrl, type) {
            var name = 'popUp';
            var appearence = 'dependent=no,menubar=no,resizable=yes,scrollbars=1,' +
                  'status=yes,toolbar=yes,titlebar=yes,' +
                  'width=' + window.screen.availWidth * 80 / 100 + ', height=' + window.screen.availHeight * 80 / 100 + ',resizable:yes,center:yes';
            var openWindow = '';
            if (type == 'open')
                openWindow = window.open(popUrl, name, appearence);
            if (type == 'popup')
                openWindow = window.showModalDialog(popUrl, name, appearence);
            openWindow.focus();
        }

        function ttt() {
            var st = document.getElementById('txtIncentiveConfirmed').value; //chuoi nay chua mang cac shCode.SN.MD.SU
            alert(st);
            var lines = st.split('|');
            var reason = '';
            $.each(lines, function (key, line) {
                var b = document.getElementById('txt.' + line).value; //lines[0] = shCode.SN.MD.SU
                alert(b);
            });
        }

        $(function () {
            $('.incentiveFlag').mouseover(function () {
                var shCodeAndSerial = $(this).attr('alt');
                var span = document.getElementById('myspan.' + shCodeAndSerial).innerHTML;
                var chk = document.getElementById('chk.' + shCodeAndSerial).style.display = 'block';
                var txt = document.getElementById('txt.' + shCodeAndSerial).style.display = 'block';

            }).mouseout(function () {
                var shCodeAndSerial = $(this).attr('alt');
                var chk = document.getElementById('chk.' + shCodeAndSerial).style.display = 'none';
                var txt = document.getElementById('txt.' + shCodeAndSerial).style.display = 'none';
            }).click(function () {
                //alert("click");
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ksdjfl" runat="server">
    </asp:ScriptManager>
    <uc1:Header ID="Header1" runat="server" />
    <div style="display: none;">
        <asp:TextBox ID="txtIncentiveConfirmed" Width="100%" ClientIDMode="Static" runat="server"></asp:TextBox>
        <input type='button' onclick='ttt();' value="Temp" />
    </div>
    <div class="Mid">
        <div class="Mid1">
            <div id="DataContent">
                <%-- <div>
                    Nội dung bên trái
                </div>--%>
                <div>
                    <div class="TitleTab">
                        <ul>
                            <li><a href="SOMSerialMgr.aspx">Daily Sales Out</a></li>
                            <li><a class="TitleTab_act" href="SOMSerialIncentiveCFM.aspx">Incentive Confirmation</a></li>
                        </ul>
                    </div>
                    <!-- DataGrid Start -->
                    <div class="Search">
                        <table>
                            <tr>
                                <td style="background-color: #F7F7F7">
                                    Period :
                                </td>
                                <td>
                                    <asp:TextBox ID="txtFromDate" runat="server" Width="80px" Enabled="true"></asp:TextBox>
                                    <asp:TextBox ID="txtToDate" runat="server" Width="80px" Enabled="true"></asp:TextBox>
                                </td>
                                <td style='width: 10px'>
                                </td>
                                <td style="background-color: #F7F7F7">
                                    Product
                                </td>
                                <td>
                                    <asp:DropDownList ID="dropAu" Width="84px" runat="server">
                                    </asp:DropDownList>
                                </td>
                                <td style='width: 10px'>
                                </td>
                                <td style="background-color: #F7F7F7">
                                    Incentive Confirmed :
                                </td>
                                <td>
                                    <asp:DropDownList ID="dropConfirmIncentive" Width="84px" runat="server">
                                        <asp:ListItem Value="0" Text="All"></asp:ListItem>
                                        <asp:ListItem Value="Y" Text="Y"></asp:ListItem>
                                        <asp:ListItem Value="N" Text="N"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td style='width: 10px'>
                                </td>
                                <td>
                                    <asp:Button id="btnImport" runat="server" CssClass="button Float-right"  Font-Names="Tahoma"
                            Width="80px" Text="Import file" />
                                </td>
                            </tr>
                            <tr>
                                <td style="background-color: #F7F7F7">
                                    Shop ID/Name :
                                </td>
                                <td>
                                    <asp:TextBox ID="txtShopCode" runat="server" Width="80px"></asp:TextBox>
                                    <asp:TextBox ID="txtShopName" runat="server" Width="160px"></asp:TextBox>
                                </td>
                                <td style='width: 10px'>
                                </td>
                                <td style="background-color: #F7F7F7">
                                    Model.Suffix :&nbsp;
                                </td>
                                <td>
                                    <asp:TextBox ID="txtModel" runat="server" Width="80px"></asp:TextBox>
                                    <asp:TextBox ID="txtSuffix" runat="server" Width="80px"></asp:TextBox>
                                </td>
                                <td style='width: 10px'>
                                </td>
                                <td style="background-color: #F7F7F7">
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    <asp:Button ID="btnFind" runat="server" CssClass="button Float-right" Width="80px"
                                        Text="Search" OnClick="btnFind_Click" />
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="overflow: auto; height: 420px;">
                        <% //420px = 10row data + 2row header %>
                        <table id="newspaper-b">
                            <thead>
                                <tr>
                                    <th scope="col">
                                        Shop ID
                                    </th>
                                    <th scope="col">
                                        Shop Name
                                    </th>
                                    <th scope="col">
                                        Serial
                                    </th>
                                    <th scope="col">
                                        Model.Suffix
                                    </th>
                                    <th scope="col">
                                        AU
                                    </th>
                                    <th scope="col">
                                        Sale in date
                                    </th>
                                    <th scope="col">
                                        Sale out date
                                    </th>
                                    <th scope="col">
                                        Incentive Confirmed
                                    </th>
                                    <th scope="col">
                                        Message
                                    </th>
                                    <th scope="col">
                                        Confirmed Date
                                    </th>
                                    <th scope="col">
                                        Confirmed By
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <asp:Literal ID="litData" runat="server"></asp:Literal>
                            </tbody>
                        </table>
                    </div>
                    <!-- DataGrid End -->
                </div>
            </div>
            <div class="Clear_both">
            </div>
        </div>
    </div>
    </form>
</body>
</html>
